package com.qiqijuice.sales;

import net.miginfocom.swt.MigLayout;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;

public class MainAppMenu extends Composite {
	
	MainAppMenu() {
		this(null);
	}
	
	public MainAppMenu(Composite frame) {
		super(frame, SWT.NONE);
		
		MigLayout mig = new MigLayout("align 50% 50%, nogrid, debug", "");
		setLayout(mig);
		
		Button b = new Button(this, SWT.PUSH);
		b.setText("Product Definition");
		b.setLayoutData("width 200:200, height 200:200, sg 1");
		b.addSelectionListener(new SelectionAdapter() {

			@Override
			public void widgetSelected(SelectionEvent e) {
				// TODO Auto-generated method stub
				notifyListeners(AppFrame.EVT_PRODUCT, new Event());
			}
			
		});
		
		b = new Button(this, SWT.PUSH);
		b.setText("Cashier");
		b.setLayoutData("sg 1");

		b.addSelectionListener(new SelectionAdapter() {

			@Override
			public void widgetSelected(SelectionEvent e) {
				// TODO Auto-generated method stub
				notifyListeners(AppFrame.EVT_CASHIER, new Event());
			}
			
		});

		b = new Button(this, SWT.PUSH);
		b.setText("Sales Analysis");
		b.setLayoutData("sg 1");
		b.addSelectionListener(new SelectionAdapter() {

			@Override
			public void widgetSelected(SelectionEvent e) {
				// TODO Auto-generated method stub
				notifyListeners(AppFrame.EVT_SALES, new Event());
			}
			
		});
	}
	
	
}
